#define _CRT_SECURE_NO_WARNINGS 2
#include<iostream>
#include<mutex>

namespace singleton
{
	class hungry
	{
	public:
		static hungry& GetInstance() { return instance_; }
	private:
		hungry(){}
		hungry(const hungry&) = delete;
		hungry& operator=(const hungry&) = delete;
	private:
		static hungry instance_;
	};
	hungry hungry::instance_;

	class lazy
	{
	public:
		static lazy& GetInstance()
		{
			if (pinst_ == nullptr)
			{
				pinst_ = new lazy;/*first use create object*/
			}
			return *pinst_;
		}
	private:
		lazy(){}
		lazy(const lazy&) = delete;
		lazy& operator=(const lazy&) = delete;
	private:
		static lazy* pinst_;
	};
	lazy* lazy::pinst_ = nullptr;
}